import request from "../utils/request";

//首页
export const indexApi = () => request.get('/jobSeeker/positions/index')

//条件查询
export const searchApi = (title, positionType, publishDate, currentPage, pageSize) => {
  return request.get(`/jobSeeker/positions?title=${title}&positionType=${positionType}&publishDate=${publishDate}&currentPage=${currentPage}&pageSize=${pageSize}`)
}

//查询联系人
export const getContactApi = (id) => request.get(`/jobSeeker/messages/${id}`)

//查询历史聊天信息
export const getHistoryMsgApi = (id) => request.get(`/jobSeeker/messages?id=${id}`)

//通过职位id查询职位详情
export const getPosByIdApi = (id) => request.get(`/jobSeeker/positions/${id}`)

//查询是否已经是好友
export const isContactApi = (id) => request.get(`/jobSeeker/messages/isContact/${id}`)
//建立好友联系
export const addContactApi = (id) => request.post(`/jobSeeker/messages/${id}`)

//保存简历
export const saveResumeApi = (resume) => request.post(`/jobSeeker/resumes`, resume)

//查询简历
export const getResumeApi = () => request.get(`/jobSeeker/resumes`)

//获取个人信息
export const getInfoApi = () => request.get(`/jobSeeker/users`)

//修改个人信息
export const updateInfoApi = (user) => request.put(`/jobSeeker/users`, user)

//修改密码将旧密码和新密码传到后端
export const updatePwdApi = (oldPwd, newPwd) => request.put(`/jobSeeker/users/pwd?oldPwd=${oldPwd}&newPwd=${newPwd}`)

// 投递简历
export const sendResumeApi = (companyId, positionId) => request.post(`/jobSeeker/resumes/${companyId}/${positionId}`)